<style>
    .sign-buy {
        color: #bbbbbb;
        font-size: 14px;
        font-weight: bold;
        background-color: #f8f8f8;
    }

    .sign-exchange {
        color: #b7ab40;
        font-size: 14px;
        font-weight: bold;
        background-color: #fffdbf;
    }
</style>
<!--start:横表-->
<table class="column-table">
    <tbody>
    <tr>
        <td>
            <span>总数: </span><span>{$order_count}</span>
        </td>
    </tr>
    </tbody>
</table>
<!--end:横表-->
<p>&nbsp;</p>
<!-- 列表 -->
{include_core file="admin/lib/pager.html"}
<table class="list-table goods-table">
    <thead>
    <tr>
        <th style="min-width:128px">订单编号</th>
        <th style="width:1em">&nbsp;</th>
        <th style="width:15%;">商品</th>
        <th style="width:1%;text-align:right;">单价</th>
        <th style="width:1%;text-align:right;">数量</th>
        <th style="width:1%;text-align:right;">单项汇总</th>
        <th style="width:1%;text-align:right;">总量</th>
        <th style="width:1%;text-align:right">价格汇总</th>
        <th style="width:20%;">商家信息</th>
        <th style="width:15%;">备注信息</th>
        <th style="width:3%;">交易状态</th>
    </tr>
    </thead>
    <tbody>
    {foreach $order_list as $k => $v}
    <tr>
        <td colspan="11" class="hr">&nbsp;</td>
    </tr>
    {if $v.order_relation_count}
    {foreach $v.order_relation as $key => $order_relation_info}
    <tr data-id="{$v.id}" id="dataList{$v.id}">
        {if $key == 0}
        <td rowspan="{$v.order_goods_count}">
            {if $v.is_diff_price > 0}<span class="label label-danger">二</span>{/if}
            {if $v.dealer_info.is_return_diff > 0}<span class="label label-success icon-dealer-2-return"></span>{/if}
            {if $v.is_ious == 1}<span class="label label-success">白</span>{/if}
            {if $v.pay_user_money > 0}<span class="label label-info">余</span>{/if}
            {if $v.exchange_num > 0}<span class="label label-warning">兑</span>{/if}
            {if $v.task_user_id}<span class="label label-default">代</span>{/if}
            {if $v.is_ious || $v.pay_user_money > 0 || $v.exchange_num > 0 || $v.diff_sum_price > 0 || $v.task_user_id || $v.dealer_info.is_return_diff > 0}<br/>{/if}
            订单号：<br/>{order_helper::order_id_encode($v.id)}<br/>
            下单时间：<br/>{$v.add_time}<br/><br/>
            {if $v.task_user_id}
            {user_helper::display_name($v.task_user_id)} 代理下单{/if}
            {if $v.task_desc}, 备注：{$v.task_desc}<br/><br/>{/if}
            {if $v.transaction_id}
            交易号:<br/>{$v.transaction_id}<br/>
            {/if}
            {if $v.operation}
            <fieldset>
                <legend class="js_order_operation_display">订单操作</legend>
                <ul style="display: none">
                    {foreach $v.operation as $operation}
                    <li>
                        {$operation[0]} : {$operation[1]}<br/>
                        {$operation[2]}
                    </li>
                    {/foreach}
                </ul>
            </fieldset>
            {/if}
        </td>
        {/if}
        {if $key == 0}
        <td class="abs-center sign-buy" rowspan="{$v.order_relation_count}"> 现 付</td>
        {/if}
        {$goods_info = $order_relation_info.goods_info}
        <td style="overflow:hidden;">
            <span class="label label-default">{$goods_info.title}</span><br/>
            分类：{$order_relation_info.category}<br/>
            商品简介：<br/>
            <p class="">{$goods_info.intro}</p>
        </td>
        <td style="text-align:right;">
            <span class="label label-default">{num_keep_two_round($order_relation_info.goods_price)}</span>
        </td>
        <td style="text-align:right;">{$order_relation_info.goods_num}</td>
        <td style="text-align:right;">
            <span class="label label-default">{num_keep_two_round($order_relation_info.real_price)}</span>
        </td>
        {if $key == 0}
        <td style="text-align:right;" rowspan="{$v.order_goods_count}">
            {$v.goods_num + $v.exchange_num}
            <br/>
            <span class="label" style="color: #666666;">{$v.order_cube} m³</span>
            <br/>
            <span class="label" style="color: #666666;">{$v.order_weight} kg</span>
        </td>
        <td rowspan="{$v.order_relation_count}" style="text-align:right;">
                <span class="label label-default" style="text-align: right">
                    {if $v.diff_sum_price * 100 > 100}
                    <span style="color: #cccccc;">含二差 {$v.diff_sum_price}</span><br/>
                    {/if}
                    总价 {num_keep_two_round($v.price)}
                </span>
            {if $v.pay_user_money > 0}
            <span class="label label-warning">余额支付 {num_keep_two_round($v.pay_user_money)}</span>
            {/if}
            <hr/>
            <span class="label label-info">需付 {num_keep_two_round($v.need_to_pay)}</span>
            <hr/>
            <span class="label label-success">当前余额 {num_keep_two_round($v.user_money)}</span>
        </td>
        <td rowspan="{$v.order_goods_count}">
            <fieldset>
                <legend>合伙人</legend>
                {$v.dealer_info.realname}<br/>{$v.dealer_info.mobile}
            </fieldset>
            <fieldset>
                <legend>收货人</legend>
                {$v.receiver}<br/>{$v.mobile}
            </fieldset>
            <fieldset>
                <legend>收货地址</legend>
                {if $v.region}
                {$v.region}&nbsp;
                {/if}
                {$v.dealer_address}
            </fieldset>
        </td>
        <td rowspan="{$v.order_goods_count}">
            {if $v.note}
            <fieldset>
                <legend>订单备注</legend>
                {$v.note}
            </fieldset>
            {/if}
            {if $v.task_desc}
            <fieldset>
                <legend>任务备注</legend>
                {$v.task_desc}
            </fieldset>
            {/if}
            {if $v.express_note}
            <fieldset>
                <legend>发货备注</legend>
                {$v.express_note}
            </fieldset>
            {/if}
            {if $v.receiver_extra}
            <fieldset>
                <legend>确认到货备注</legend>
                {$v.receiver_extra}
            </fieldset>
            {/if}
            {if $v.reason}
            <fieldset>
                <legend>订单取消理由</legend>
                {$v.reason}
            </fieldset>
            {/if}
            {if $v.confirm_payoff_time > '0000-00-00 00:00:00'}
            <fieldset>
                <legend style="color: red;">[旧]订单付款信息</legend>
                付款人: {$v.payoff_persion}<br/>
                付款金额: {$v.payoff_money}<br/>
                付款时间: {$v.payoff_time}<br/>
                助理确认付款时间: {$v.confirm_payoff_time}<br/>
                确认付款备注: {$v.payoff_extra}
            </fieldset>
            {/if}
            {if $v.confirm_money_name != ''}
            <fieldset>
                <legend style="color: red;">[旧]订单收款信息</legend>
                确认收款人: {$v.confirm_money_name}<br/>
                确认收款时间: {$v.confirm_money_time}<br/>
                确认收款备注: {$v.confirm_money_note}
            </fieldset>
            {/if}
        </td>
        <td rowspan="{$v.order_goods_count}" class="js_order_operation">
            {if $v.progress == order_config::DEALER_CANCEL}
            <span class="label label-default">{order_config::$dealer_progress[$v.progress]}</span>
            {elseif $v.progress == order_config::DEALER_WAIT_PAY}
            <span class="label label-danger">{order_config::$dealer_progress[$v.progress]}</span>
            {elseif $v.progress > order_config::DEALER_WAIT_PAY && $v.progress < order_config::DEALER_DONE}
            <span class="label label-warning">{order_config::$dealer_progress[$v.progress]}</span>
            {elseif $v.progress == order_config::DEALER_DONE}
            <span class="label label-success">{order_config::$dealer_progress[$v.progress]}</span>
            {/if}
            {if $v.status}
            {$order_info = $v}
            {include file="part/dealer_order_operation.html"}
            {/if}
            {if $role_id == user_config::ADMIN || $role_id == user_config::OPERATOR}
            <hr>
            {if $v.status}
            <a href="{AnUrl('order/admin/delete')}?id={$v.id}" class="btn btn-danger btn-xs js_deleteOrder"><i class="icon-trash icon-white"></i>删除订单</a>
            {else}
            <a href="{AnUrl('order/admin/change_status')}?id={$v.id}" class="btn btn-warning btn-xs js_changeStatus"><i class="icon-trash icon-white"></i>还原</a>
            {/if}
            {/if}
            <a class="btn btn-xs btn-success" target="_blank" href="{AnUrl('order/admin/order_detail')}?id={$v.id}">订单详情</a>
        </td>
        {/if}
    </tr>
    {/foreach}
    {/if}
    {if $v.order_exchange_relation_count}
    {foreach $v.order_exchange_relation as $key => $order_exchange_relation_info}
    {$goods_info = $order_exchange_relation_info.goods_info}
    <tr style="background-color:#fffeec">
        {if $key == 0}
        <td class="abs-center sign-exchange" rowspan="{$v.order_exchange_relation_count}">兑 换</td>
        {/if}
        <td style="overflow:hidden;">
            <span class="label label-warning">{$goods_info.title}</span><br/>
            分类：{$order_exchange_relation_info.category}<br/>
            商品简介：<br/>
            <p class="">{$goods_info.intro}</p>
        </td>
        <td style="text-align: right"><span class="label label-warning">{intval($order_exchange_relation_info.goods_price)} 币</span></td>
        <td style="text-align: right">{$order_exchange_relation_info.goods_num}</td>
        <td style="text-align: right"><span class="label label-warning">{intval($order_exchange_relation_info.real_price)} 币</span></td>
        {if $key == 0}
        <td rowspan="{$v.order_exchange_relation_count}" style="text-align:right;">
            <span class="label label-warning">抱币总计 {intval($v.pay_bbcoin)}</span>
        </td>
        {/if}
    </tr>
    {/foreach}
    {/if}
    {foreachelse}
    <tr>
        <td class="txtleft" colspan="11">暂无数据</td>
    </tr>
    {/foreach}
    </tbody>
</table>
{include_core file="admin/lib/pager.html"}
<!-- /列表 -->
{load_js file='module/order_operation.js'}
{load_js file='module/order_operation_display.js'}
{include_core file="module/dealer_order_minus.html"}
{include_core file="module/dealer_order_add_comments.html"}
{include_core file="module/dealer_order_confirm.html"}
{include_core file="module/dealer_order_print.html"}
{include_core file="module/dealer_order_send.html"}
{include_core file="module/dealer_order_done.html"}
{include_core file="module/dealer_order_cancel.html"}
{include_core file="module/order_delete.html"}